package com.usaas.search.controller.app.mine;

import com.usaas.common.core.domain.AjaxResult;
import com.usaas.search.controller.app.AppBaseController;
import com.usaas.search.dto.AppPlatUserLoginDto;
import com.usaas.search.interceptor.realnameauth.RealNameAuth;
import com.usaas.search.service.app.AppPlatUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 我的
 *
 * @author Helios
 * @date 2024-08-14
 */
@RestController
@RequestMapping("/app/search/user")
public class AppPlatUserController extends AppBaseController {

    @Autowired
    private AppPlatUserService appPlatUserService;

    /**
     * 短信登录验证码
     */
    @PostMapping("/sendMobileLoginSms")
    public AjaxResult sendMobileLoginSms(@RequestBody AppPlatUserLoginDto dto) {
        return appPlatUserService.sendMobileLoginSms(dto);
    }

    /**
     * 手机号登录或者注册
     */
    @PostMapping("/mobileLoginOrRegister")
    public AjaxResult mobileLoginOrRegister(@RequestBody AppPlatUserLoginDto dto) {
        return appPlatUserService.mobileLoginOrRegister(dto);
    }

    /**
     * 退出登录
     */
    @PostMapping("/logout")
    public AjaxResult logout(HttpServletRequest request, @RequestBody AppPlatUserLoginDto dto) {
        return appPlatUserService.logout(request, dto);
    }

    /**
     * 注销账号
     */
    @PostMapping("/signout")
    public AjaxResult signout(HttpServletRequest request, @RequestBody AppPlatUserLoginDto dto) {
        return appPlatUserService.signout(request, dto);
    }


    /**
     * 获取用户信息
     */
    @PostMapping("/queryUserInfo")
    public AjaxResult queryUserInfo(@RequestBody AppPlatUserLoginDto dto) {
        return appPlatUserService.queryUserInfo(dto);
    }

    /**
     * 修改资料
     */
    @RealNameAuth
    @PostMapping("/updateUserInfo")
    public AjaxResult updateUserInfo(HttpServletRequest request, @RequestBody AppPlatUserLoginDto dto) {
        return appPlatUserService.updateUserInfo(request, dto);
    }

    /**
     * 修改密码
     */
    @RealNameAuth
    @PostMapping("/resetPwd")
    public AjaxResult resetPwd(HttpServletRequest request, @RequestBody AppPlatUserLoginDto dto) {
        return appPlatUserService.resetPwd(request, dto);
    }

    /**
     * 实名认证
     */
    @PostMapping("/realNameAuthentication")
    public AjaxResult realNameAuthentication(HttpServletRequest request, @RequestBody AppPlatUserLoginDto dto) {
        return appPlatUserService.realNameAuthentication(request, dto);
    }
}
